﻿@using FwProject.PrePaymentInfo.Dto
@using FwProject.Settlement.Dto
@model Tuple<ReceiptInfoDto, List<SettlementInfoDto>>
@{
    Layout = null;

    decimal SumReceivedPrice = 0;
    decimal SumReceivedDiscount = 0;
}

<link href="/css/print.css" rel="stylesheet" />
<style type="text/css">

    .input-group[class*=col-] {
        padding: 0 15px;
    }

    .Noprint {
        display: none;
    }

    .PageNext {
        page-break-after: always;
    }

    * {
        word-wrap: break-word;
        word-break: break-all;
    }

    table {
        border-collapse: collapse;
        border-spacing: 0px;
    }
</style>

<object id="factory" viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
        codebase="/scripts/smsx.cab#Version=6,2,433,70"></object>
<!-----------------------------【smsx.cab】打印--------------------------->
<form name="printformName" id="printformName" action="" method="post">
    <div align="center">

        <!-----------------------------【smsx.cab】打印--------------------------->
        <!--打印前初始化设置-->
        <script language="javascript">

            p_init({
                portrait: true//true纵向,false横向
            });

        </script>

        <p>
            <input type="button" class="notprint" name="Submit" value="打印" onclick="pagePrint();" />
        </p>
        <!-----------------------------【smsx.cab】打印--------------------------->
        <div id="printObj"style="width: 190mm" align="center">
            <span id='valueSpanID'>&nbsp;</span>
            <div align="center" style="font-size: 14px; margin-top: 3px; margin-bottom: 15px; font-weight: bold;">
                收款单
            </div>

            <table width="100%" cellspacing="0" cellpadding="0" align="center" border="0">
                <tr>
                    <td width="10%"><b>单号</b>:</td>
                    <td>&nbsp;@Model.Item1.ReceiptInfoNumber</td>
                    <td width="10%"><b>收款日期</b>:</td>
                    <td>&nbsp;@Model.Item1.Dateofreceipt.Value.ToString("yyyy-MM-dd HH:mm:ss")</td>

                </tr>
                <tr>
                    <td width="10%"><b>餐厅</b>:</td>
                    <td>&nbsp;@Model.Item1.RestaurantInfoModel.RestaurantName</td>
                    <td><b>经办人</b>:</td>
                    <td>&nbsp;@Model.Item1.AgentPeoper</td>
                </tr>
                <tr>
                    <td nowrap><b>当前预收款余额</b>:</td>
                    <td>&nbsp;@Model.Item1.UsePrePaymentSurplus</td>
                    <td nowrap><b>使用预收款</b>:</td>
                    <td>&nbsp;@Model.Item1.UsePrePayment</td>
                </tr>
                <tr>
                    <td><b>收款账户</b>:</td>
                    <td>&nbsp;@ViewBag.Account</td>
                    <td><b>收款金额</b>:</td>
                    <td>&nbsp;@Model.Item1.TaskBackAmount</td>
                </tr>
                <tr>
                    <td><b>备注</b>:</td>
                    <td colspan="3">&nbsp;@Model.Item1.RemarksConten</td>
                </tr>
            </table>
            <br>


            <table width="100%" cellspacing="0" cellpadding="0" align="center" border=1 borderColor="black">
                <tr>
                    <td align="center"><b>单据类型</b></td>
                    <td align="center"><b>单据编号</b></td>
                    <td align="center"><b>单据日期</b></td>
                    <td align="center"><b>应收金额</b></td>
                    <td align="center"><b>未收金额</b></td>
                    <td align="center"><b>收款金额</b></td>
                    <td align="center"><b>收款优惠</b></td>
                    <td align="center"><b>备注</b></td>
                </tr>
                @foreach (var item in Model.Item2)
                {
                    <tr>
                        <td>@item.BalanceWayEnum</td>
                        <td>@item.CreationNumber</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd")</td>
                        <td>@item.Actualprice</td>
                        <td>@(item.Totalprice - item.ReceivedPrice-item.ReceivedDiscount-item.UsePrePayment)</td>
                        <td>@item.ReceivedPrice</td>
                        <td>@item.ReceivedDiscount</td>
                        <td>@item.RemarksConten</td>
                    </tr>
                    SumReceivedPrice += item.ReceivedPrice;
                    SumReceivedDiscount += item.ReceivedDiscount;
                }
                <tr>
                    <td align="center"><b>合计</b></td>
                    <td colspan="4"></td>
                    <td>@SumReceivedPrice</td>
                    <td>@SumReceivedDiscount</td>
                    <td></td>
                </tr>
            </table>
        </div>
    </div>
</form>


<script src="~/js/Print.js"></script>
<script>
    var loadInfo = function () {
        //$("#printObj").css({ "width": "270mm" });
        p_init(printInit);
    };
    $(function () {
        loadInfo();
    });

    function pageSet() {
        try {
            p_pagesetup();
        } catch (e) {
            wb.execwb(8, 1);
        }
    }
    function pageView() {
        try {
            p_preview();
        } catch (e) {
            wb.execwb(7, 1);
        }
    }
    function pagePrint() {
        try {
            p_print();
        } catch (e) {
            wb.execwb(6, 6);
        }
    }
</script>



